﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LogicUniversityBiz;
namespace LogicUniversity.clerks
{
    public partial class ReorderReport : System.Web.UI.Page
    {
        private ReorderReportControl report = new ReorderReportControl();
        protected void Page_PreInit(Object sender, EventArgs e)
        {
            //(Session["Role"]
            if (Session["Role"] as string != "Clerk")
            {
                Response.Redirect("~/Login.aspx");
            }

        }
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnSelect_Click(object sender, EventArgs e)
        {
            DateTime date = DateTime.Parse(txtDate.Text.Trim());

            IQueryable query = report.getPurchaseOrderBy(date);

            if (query != null)
            {
                btnPrint.Visible = true;
                ReorderReportView.DataSource = report.getPurchaseOrderBy(date);
                ReorderReportView.DataBind();
            }
            
        }

        protected void btnPrint_Click(object sender, EventArgs e)
        {
            try
            {
                ClientScript.RegisterStartupScript(GetType(), "openwindow", "<script type=text/javascript>window.print();</script>");
            }
            catch (Exception ex)
            {

            }
        }
    }
}